For a form that passes variables to an application on a web server, you want to verify that the audience is entering proper information. For example, you don't want your audience to enter text in a phone number field. Use a series of Set Variable
statements in conjunction with Loop
and If
to evaluate entered data.
The following sample action checks to see whether the data is a number, and that the number is in the format ###-###-####. If the data is valid, the message "Good, this is a valid phone number!" is displayed. If the data is not valid, the message "This phone number is invalid!" is displayed:
On (Release) If (Length(PhoneNumber) = 12) Set Variable: "Index" = 1 Set Variable: "Valid" = true Loop While (Index <= 12 and Valid) Set Variable: "Char" = Substring(PhoneNumber,Index,1) If (Index = 4 or Index = 8) If (Char ne "-") Set Variable: "Valid" = false End If Else If (not (Ord(Char) >= Ord("0") and Ord(Char) <= Ord("9"))) Set Variable: "Valid" = false End If End If Set Variable: "Index" = Index+1 End Loop Else Set Variable: "Valid" = false End If If (Valid = true) Set Variable: "Message" = "Good, this is a valid phone number!" Else Set Variable: "Message" = "This phone number is invalid!" End If End On
When the time comes to send the data, create a button that has an action similar to the following. (Replace the Get URL
parameters with parameters appropriate for your movie.):
On (Release) If (Valid = true) Get URL ("www.webserver.com", window="_self", vars=GET) End If End On